/*
 * @Author: 邵渊
 * @LastEditors: 邵渊
 * @Description: 文件上传相关接口
 */
import { request } from "./request";

// 简单文件上传
export function simpleUpload(data: any) {
  return request({
    url: "/xydApi/basic/upload",
    method: "post",
    headers: { "Content-Type": "multipart/form-data" },
    data,
  });
}

// 获取上传文件列表
export const uploadPageList = (data: any) => {
  return request<any>({
    method: "POST",
    url: `/xydElement/basic/selectFilesInfo?fileSize=${data.fileSize}&page=${data.page}`,
  });
};

// 删除文件
export const deleteUploadFile = (data: any) => {
  return request<any>({
    method: "DELETE",
    url: `/xydElement/basic/deleteByUrl?url=${encodeURIComponent(data)}`,
  });
};

// 下载文件
export const downloadUploadFile = (data: any) => {
  return request<any>({
    method: "GET",
    url: `/xydElement/basic/downloadByUrl?url=${encodeURIComponent(data)}`,
    responseType: "blob",
  });
};
